//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package common;

public class GlobalTimerIdentifier {
    private Integer ticks = Integer.valueOf(0);
    private Integer objectTicks = Integer.valueOf(0);
    private Integer id = Integer.valueOf(0);
    private Integer accelerator = Integer.valueOf(1);
    public static final Integer oneTick = Integer.valueOf(303);
    public static final Integer oneObjectTick = Integer.valueOf(1515);

    public GlobalTimerIdentifier() {
    }

    public Integer get() {
        return this.id = Integer.valueOf(this.id.intValue() + 1);
    }

    public void reset() {
        this.id = Integer.valueOf(0);
        this.ticks = Integer.valueOf(0);
        this.objectTicks = Integer.valueOf(0);
    }

    public int getNextTick() {
        this.ticks = Integer.valueOf(this.ticks.intValue() + oneTick.intValue() * this.accelerator.intValue());
        this.objectTicks = Integer.valueOf(this.objectTicks.intValue() + oneObjectTick.intValue() * this.accelerator.intValue());
        return this.ticks.intValue();
    }

    public int getNextTick(long ms) {
        if(ms >= 10000L) {
            return this.getNextTick();
        } else {
            double ticksForMs = (double)oneTick.intValue() / 10000.0D;
            int msticks = (int)((double)ms * ticksForMs);
            if(msticks < 1) {
                msticks = 1;
            }

            this.ticks = Integer.valueOf(this.ticks.intValue() + msticks);
            this.objectTicks = Integer.valueOf(this.objectTicks.intValue() + msticks * 5);
            return this.ticks.intValue();
        }
    }

    public int getCurrentTicks() {
        return this.ticks.intValue();
    }

    public int getObjectTicks() {
        return this.objectTicks.intValue() / 10;
    }
}
